# -*- encoding=utf8 -*-
"""
RedFlag-TC000069   切换拍摄48S
点击切换拍摄48S场景
滑动切换拍摄48S场景
"""
__author__ = "ldm"

import sys
import os

# 获取当前脚本所在目录.py
current_dir = os.path.dirname(os.path.abspath(__file__))
# 获取上级目录.air
parent_dir = os.path.dirname(current_dir)
# 获取上级目录air
grandparent_dir = os.path.dirname(parent_dir)
# 获取和air目录平级的conf、testcase目录路径
conf_dir = os.path.join(grandparent_dir, 'conf')
testcase_dir = os.path.join(grandparent_dir, 'testcase')
# 将conf、testcase目录添加到sys.path
sys.path.append(conf_dir)
sys.path.append(testcase_dir)

from PageFunction import CameraVideoShooter
from elements import *
auto_setup(__file__)

shooter = CameraVideoShooter()

log("--------------------------------点击切换拍摄60S场景--------------------------------------")
"""
进入相机拍摄
点击拍48S
获取文本
断言
"""

shooter.enter_photograph()
shooter.click_element(shooting_page_60_seconds)
text1 = shooter.get_element_text(poco("cn.migu.video.clip.walle:id/recycler_tab_layout").child()[3])
shooter.assert_texts_equal(text1, "60s", "断言失败，预期文案与实际文案不符合，没有切换到拍48S")

# log("--------------------------------滑动切换拍摄60S场景--------------------------------------")
# """
# 进行滑动到15S
# 进行滑动到48S
# 断言
# """
#
# shooter.swipe_screen((0.5, 0.9), (0.6, 0.9), duration = 0.1)
# sleep(1.0)
# shooter.swipe_screen((0.4, 0.9), (0.3, 0.9), duration = 0.1)
# sleep(1.0)
# text2 = shooter.get_element_text(poco("cn.migu.video.clip.walle:id/recycler_tab_layout").child()[3])
# shooter.assert_texts_equal(text2, "60s", "断言失败，预期文案与实际文案不符合，没有切换到拍48S")

log("--------------------------------点击切换拍摄3min场景--------------------------------------")
"""
进入相机拍摄
点击拍48S
获取文本
断言
"""

shooter.click_element(shooting_page_3_min)
text1 = shooter.get_element_text(poco("cn.migu.video.clip.walle:id/recycler_tab_layout").child()[3])
shooter.assert_texts_equal(text1, "3min", "断言失败，预期文案与实际文案不符合，没有切换到拍48S")

# log("--------------------------------滑动切换拍摄3min场景--------------------------------------")
# """
# 进行滑动到7S
# 进行滑动到48S
# 断言
# """
#
# shooter.swipe_screen((0.5, 0.9), (0.6, 0.9), duration = 0.1)
# sleep(1.0)
# shooter.swipe_screen((0.4, 0.9), (0.3, 0.9), duration = 0.1)
# sleep(1.0)
# text2 = shooter.get_element_text(poco("cn.migu.video.clip.walle:id/recycler_tab_layout").child()[3])
# shooter.assert_texts_equal(text2, "3min", "断言失败，预期文案与实际文案不符合，没有切换到拍48S")

# 关闭应用
stop_app(UGC_package_name)